
function getHttpRequest() {
	if (window.XMLHttpRequest) {
		var req = new XMLHttpRequest();
			
			// some versions of Moz do not support the readyState property
			// and the onreadystate event so we patch it!
		if (req.readyState == null) {
			req.readyState = 1;
			req.addEventListener("load", function () {
				req.readyState = 4;
				if (typeof req.onreadystatechange == "function") {
					req.onreadystatechange();
				}
			}, false);
		}
		return req;
	}
	if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XmlHttp");
	}
}
function $$() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == "string") {
			element = document.getElementById(element);
		}
		if (arguments.length == 1) {
			return element;
		}
		elements.push(element);
	}
	return elements;
}
function digg(id) {
	var xmlhttp = getHttpRequest();
	xmlhttp.open("post", "digg.ajax?type=tag&id=" + id, false);
	xmlhttp.send("");
	var r = xmlhttp.responseText;
	if (r == "ok") {
		$$("diggStatus_" + id).innerHTML = "\u8c22\u8c22\uff01";
		$$("diggCount_" + id).innerHTML = 1 + parseInt($$("diggCount_" + id).innerHTML);
	} else {
		TB_show("\u8bf7\u767b\u5f55", "html/ajaxLogin.htm?height=300&width=500");
	}
}
String.prototype.trim = function () {
	return this.replace(/(^\s*)|(\s*$)/g, "");
};

